const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}


// 定义加密方法
// const encrypt = (str, key) => {
//     let keyHex = CryptoJS.enc.Utf8.parse(key)
//     let encrypted = CryptoJS.DES.encrypt(str, keyHex, {
//       mode: CryptoJS.mode.ECB,
//       padding: CryptoJS.pad.Pkcs7
//     })
//     return encrypted.toString()
//   }

// // 定义解密方法
// const decrypt = (str, key) => {
//     let keyHex = CryptoJS.enc.Utf8.parse(key)
//     let decrypted = CryptoJS.DES.decrypt(str, keyHex, {
//       mode: CryptoJS.mode.ECB,
//       padding: CryptoJS.pad.Pkcs7
//     })
//     return decrypted.toString(CryptoJS.enc.Utf8)
//   }
module.exports = {
  formatTime,
 
}
